﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Server;
using ChatData;

namespace Client
{
    /// <summary>
    /// Displays a Message Object and exposes functionality
    /// </summary>
    public partial class Message : MessageControlBase
    {
        public event PostReplyEventhandler Reply;
        public Message()
        {
            InitializeComponent();
        }
        public Message(Post newentry)
        {
            InitializeComponent();
            this.myEntry = newentry;
            kryptonHeader1.Values.Heading = myEntry.MessageContent;
            kryptonHeader1.Values.Description = myEntry.User;
            this.User = myEntry.User;
        }
        private void buttonSpecAny1_Click(object sender, EventArgs e)
        {
            this.OnReply(this,new ReplyChatEventArgs<Post>(myEntry, User));
        }
        protected virtual void OnReply(object sender, ReplyChatEventArgs<Post> e)
        {
           Reply(sender, e); // Reply(this,e) kept throwing exceptions.
        }
    }

    public class MessageControlBase : MessageBase<Post>
    { }

}
